package com.happy3w.bean.factory;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
import lombok.Getter;
import lombok.Setter;

@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeIdResolver(BeanConfigItemResolver.class)
@Getter
public abstract class BeanConfigItem {
    /**
     * 配置名称，确保全局唯一
     */
    @Setter
    protected String name;

    /**
     * 是否启用, 默认为true
     */
    @Setter
    protected Boolean enabled;

    /**
     * 配置类型，确保全局唯一，只读
     */
    private final String type;

    protected BeanConfigItem(String type) {
        this.type = type;
    }
}
